package com.example.springboottestgit.bean;

/**
 * @description: 业务异常
 * @author: ZZZ
 */
public class BusinessException extends RuntimeException {
    private static final String DEFAULT_CODE = "500";
    private static final String DEFAULT_DESC = "系统异常";
    private String code;
    private String desc;

    public BusinessException(String code, String message, String desc) {
        super(message);
        this.code = code;
        this.desc = desc;
    }

    public BusinessException(String code, String desc) {
        super(desc);
        this.code = code;
        this.desc = desc;
    }

    public BusinessException() {
        this("系统异常");
    }

    public BusinessException(String msg) {
        super(msg);
        this.code = "500";
        this.desc = null == msg ? "系统异常" : msg;
    }

    public String getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.desc;
    }

    public String toString() {
        return "BusinessException{code='" + this.code + '\'' + ", desc='" + this.desc + '\'' + '}';
    }
}